package jp.ac.u_tokyo.dch.model.xml.tree;

import java.util.ArrayList;
import java.util.List;

import org.simpleframework.xml.Attribute;
import org.simpleframework.xml.ElementList;
import org.simpleframework.xml.Root;


@Root(name = "gdata")
public class Gdata {

	@ElementList(required = false, inline = true)
	private List<Gdata> gdataList;

	@ElementList(required = false, inline = true)
	private List<Rdata> rdataList;

	@Attribute(name = "label" , required = false)
	private String label;

	@Attribute(name = "value", required = false)
	private String value;

	private int level;

	public List<Gdata> getGdataList() {
		return gdataList;
	}

	public void setGdataList(List<Gdata> gdataList) {
		this.gdataList = gdataList;
	}

	public List<Rdata> getRdataList() {
		return rdataList;
	}

	public void setRdataList(List<Rdata> rdataList) {
		this.rdataList = rdataList;
	}

	public String getLabel() {
		return label;
	}

	public void setLabel(String label) {
		this.label = label;
	}

	public String getValue() {
		return value;
	}

	public void setValue(String value) {
		this.value = value;
	}

	public int getLevel() {
		return level;
	}

	public void setLevel(int level) {
		this.level = level;
	}


	public void addData(String label, String oyaLabel, int lv) {

		if (level + 1 == lv) {

			if (gdataList == null) {
				gdataList = new ArrayList<Gdata>();
			}

			Gdata data = new Gdata();
			data.setLabel(label);
			data.setLevel(lv);
			gdataList.add(data);

		} else if (level + 1 < lv) {


		}

	}
}
